import React, { useEffect } from 'react'
import "./index.css"
import Header from './Header'
import Main from './Main'
import Footer from './Footer'

import { useDispatch, useSelector } from 'react-redux'

import { initTesk } from '../../store/Slice/taskReducer'

export default function Todo() {
    const dispatch = useDispatch()

    
    useEffect(() => {
        const todoList = JSON.parse(localStorage.getItem('todoList'))
        dispatch(initTesk(todoList))
    }, [])
   
    


    const tesk = useSelector(state => state.tesk.tesk)


    return (
        <div>
            <div className="todo-container">
                <div className="todo-wrap">
                    <Header />
                    <Main />
                    <Footer tesk={tesk} />
                </div>
            </div>
        </div>
    )
}
